﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Core.Model;
using PersonalHealth.Data.Model;

namespace PersonHealth
{
    /// <summary>
    /// MessgeForm.xaml 的交互逻辑
    /// </summary>
    public partial class MessageForm : Page
    {
        public MessageForm()
        {
            InitializeComponent();
        }

        public MessageForm(IItem obj) : this()
        {
            if (obj != null)
            {
                if (obj is Message)
                {
                    title.Text = (obj as Message).Title;
                    tbText.Text = (obj as Message).Msg;
                    tbName.Text = (obj as Message).FromUser.Name;
                    tbDate.Text = (obj as Message).CreateDate.ToShortDateString();
                    tbName.Visibility = Visibility.Visible;
                    tbDate.Visibility = Visibility.Visible;
                }
                if (obj is HealthReport)
                {
                    title.Text = (obj as HealthReport).Title;
                    tbText.Text = (obj as HealthReport).Text;
                    tbName.Visibility = Visibility.Collapsed;
                    tbDate.Visibility = Visibility.Collapsed;
                }
                if (obj is Task)
                {
                    title.Text = (obj as Task).Title;
                    tbText.Text = (obj as Task).Text;
                    tbName.Visibility = Visibility.Collapsed;
                    tbDate.Visibility = Visibility.Collapsed;
                }
            }
        }

        public class MessageForMessageFrom
        {
 
        }

        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            NavigationService.GoBack();
        }
    }
}
